package com.bjsj.pro.ui;

import android.os.Build;
import android.webkit.WebSettings;
import android.webkit.WebView;

import com.bjsj.pro.base.AAAPresentr;
import com.bjsj.pro.base.MVPBaseActivity;
import com.bjsj.pro.base.NullView;
import com.bjsj.pro.R;

/**
 * Created by Nevermore on 2018/1/20.
 * <p>
 * demo界面,方便复制
 */

public class primaryActivity extends MVPBaseActivity<NullView, AAAPresentr> implements
        NullView
{
    private WebView webView;
    private WebSettings webSetting;
    @Override     protected AAAPresentr createPresenter()
    {
        return new AAAPresentr(this);
    }


    @Override
    protected int setLayoutResId()
    {
        return R.layout.primary_layout;
    }

    @Override
    protected void initData()
    {

        setFullScreen();
        //mTitleBarLayout.setLefeShow(true, R.drawable.ic_back, null);
        showTitleBarLayout(true,"隐私政策",null,R.drawable.round_login);
        webView=(WebView)findViewById(R.id.webview);
        webSetting = webView.getSettings();

        //这个配置是为了解决页面显示“请在微信客户端打开链接问题”
        String userAgentString = webSetting.getUserAgentString();
        // webSetting.setUserAgentString(userAgentString + " XBS_APP/"+ GlobalTools.getInstance().getVersionName(getContext()));
        webSetting.setJavaScriptEnabled(true);
        webSetting.setJavaScriptCanOpenWindowsAutomatically(true);
        webSetting.setAllowFileAccess(true);
        // webSetting.setLayoutAlgorithm(LayoutAlgorithm.NARROW_COLUMNS);
        webSetting.setSupportZoom(true);
        webSetting.setBuiltInZoomControls(true);
        webSetting.setUseWideViewPort(true);
        webSetting.setSupportMultipleWindows(true);
        webView.clearCache(true);
        // webSetting.setLoadWithOverviewMode(true);
        webSetting.setAppCacheEnabled(true);
        // webSetting.setDatabaseEnabled(true);
        webSetting.setDomStorageEnabled(true);
        webSetting.setGeolocationEnabled(true);
        webSetting.setAppCacheMaxSize(Long.MAX_VALUE);
        // webSetting.setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);
        webSetting.setPluginState(WebSettings.PluginState.ON_DEMAND);
        // webSetting.setRenderPriority(WebSettings.RenderPriority.HIGH);
        webSetting.setCacheMode(WebSettings.LOAD_NO_CACHE);
        // this.getSettingsExtension().setPageCacheCapacity(IX5WebSettings.DEFAULT_CACHE_CAPACITY);//extension
        // settings 的设计
        //允许android调用javascript
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            webSetting.setAllowFileAccessFromFileURLs(true);
            webSetting.setAllowUniversalAccessFromFileURLs(true);
        }
        webSetting.setLoadWithOverviewMode(true);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            webSetting.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
        }
        webView.loadUrl("http://bj.microdada.net/");
    }

    @Override
    protected void initView()
    {

    }








}
